package com.lr.service.impl;

import com.lr.domain.entity.Employee;
import com.lr.infra.mapper.EmployeeMapper;
import com.lr.service.EmployeeService;
import org.springframework.stereotype.Service;


import javax.annotation.Resource;
import java.util.List;

@Service
public class EmployeeServiceImpl implements EmployeeService {
    @Resource
    private EmployeeMapper employeeMapper;

    @Override
    public List<Employee> findEmployeeByCondition() {
        List<Employee> employee = employeeMapper.findEmployeeByCondition();
        return employee;
    }

    @Override
    public void createEmployee(Employee employee) {
        employeeMapper.createEmployee(employee);
        System.out.println("插入成功！");
    }

    @Override
    public void deleteEmployee(Integer id) {
        employeeMapper.deleteEmployee(id);
        System.out.println("删除成功！");
    }

    @Override
    public void updateEmployee(Employee employee) {
        employeeMapper.updateEmployee(employee);
        System.out.println("更新成功！");
    }

    @Override
    public List<Employee> oneToOne() {
        List<Employee> employees = employeeMapper.oneToOne();
        System.out.println("组合查询成功！");
        return employees;
    }
}
